import Vue from 'vue'
import VueRouter from 'vue-router'
// 第一步：导入组件（页面组件）
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

// 第二步：创建路由规则
const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // 这里是路由懒加载,注意这个注释不能删除!
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/pro',
    name: 'pro',
    // 这里是路由懒加载,注意这个注释不能删除!
    component: () => import(/* webpackChunkName: "pro" */ '../views/ProView.vue')
  },
  {
    path: '/slot',
    name: 'slot',
    // 这里是路由懒加载,注意这个注释不能删除!
    component: () => import(/* webpackChunkName: "pro" */ '../views/SlotView.vue')
  }
]

// 第三步：实例化路由对象
const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
